<%@ page import="org.subject.entity.User" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%--引入 jstl--%>
<%@include file="common/tag.jsp" %>
<%-- 获取资源根路径--%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<html>
<head>
    <title>竞赛详情页</title>
    <%@include file="common/head.jsp" %>
    <style>
        a {
            text-decoration: none
        }

        .center {
            width: auto;
            display: table;
            margin-left: auto;
            margin-right: auto;
        }

        html, body {
            margin: 0;
            padding: 0;
            height: 100%;
        }

        #container {
            min-height: 100%;
            height: auto !important;
            height: 100%; /*IE6不识别min-height*/
            position: relative;
        }

        #page {
            width: 100%;
            margin-bottom: 50px; /*等于footer的高度*/
        }
    </style>
    <script>
        function onClick() {
            alert("报名成功！");
            var button = document.getElementById("commit");
            button.onclick = false;
        }
    </script>
    <%
        User user = (User) session.getAttribute("user");
    %>
</head>
<body background="/./resource/images/bg.jpg" style="background-size: cover;background-repeat: no-repeat;">
<%--页面显示部分--%>
<div id="container" class="container">
    <jsp:include page="common/Top.jsp"/>
    <div id="page" class="panel panel-default">
        <div class="panel-heading">
            <h5><b>竞赛详情页</b></h5>
        </div>
        <div class="blog-post">
            <h2 class="blog-post-title center">${title}</h2>
            <p class="blog-post-meta center">发布时间：<fmt:formatDate value="${createtime}"
                                                                  pattern="yyyy-MM-dd HH:mm:ss"/> 发布人：${name}</p>
            <p style="margin-left: 20px;margin-right: 20px;"><b>竞赛内容：</b> ${content}</p>
            <p style="margin-left: 20px;margin-right: 20px;"><b>竞赛描述：</b> ${desc}</p>
            <p style="margin-left: 20px;margin-right: 20px;"><b>竞赛要求：</b> ${requirement}</p>
            <p style="margin-left: 20px;margin-right: 20px;"><b>报名时间：</b> ${registerstart} —— ${registerend}</p>
            <p style="margin-left: 20px;margin-right: 20px;"><b>比赛时间：</b> ${teststart} —— ${testend}</p>

            <c:choose>
                <c:when test="${sessionScope.user != null}">
                    <c:choose>
                        <c:when test="<%=user.getUserRole()==3%>">
                            <c:choose>
                                <c:when test="${state.equals('1')}">
                                    <a href="#" class="btn btn-default disabled" role="button"
                                       style="margin-left: 20px">我要报名</a>
                                </c:when>
                                <c:otherwise>
                                    <a href="<%= basePath %>regist/addregist?userId=<%=user.getUserId()%>&messageId=${messageid}"
                                       class="btn btn-primary" role="button" style="margin-left: 20px">我要报名</a>
                                </c:otherwise>
                            </c:choose>
                        </c:when>
                        <c:otherwise>
                            <a href="#" class="btn btn-default disabled" role="button"
                               style="margin-left: 20px">我要报名</a>
                        </c:otherwise>
                    </c:choose>
                    <%--<button class="btn btn-primary" id="commit" onclick="onClick()" disabled="disabled" value="我要报名"/>--%>
                </c:when>
                <c:otherwise>
                    <a href="#" class="btn btn-default btn-lg disabled" role="button"
                       style="margin-left: 20px;margin-bottom: 30px;">我要报名</a>
                </c:otherwise>
            </c:choose>
        </div>
    </div>
    <jsp:include page="common/footer.jsp"/>
</div>
</body>
<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</html>